package com.kk.dp.celue;

/**
 * @Description:
 * @Author: kangkai
 * @Date: 2025/3/13 21:32
 */
public class Sorter<T> {

    public void sort(T[] a ,Comparable1<T> comparable1s) {
        for (int i = 0; i < a.length; i++) {
            int minPos = i;
            for (int j = i + 1; j < a.length; j++) {
                minPos = comparable1s.compareTo(a[j],(a[minPos])) == -1 ? j : minPos;
            }
            swap(a, i, minPos);
        }
    }

     void swap(T[] a, int i, int j) {
        T temp = a[i];
        a[i] = a[j];
        a[j] = temp;
    }

}
